<?php
namespace base\service;
use think\facade\Cache;
require_once 'extend/lib/phpMailer/class.phpmailer.php';
require_once 'extend/lib/phpMailer/class.smtp.php';

class MailerApi {
	
	public $errorInfo = '';
	
	/**
    * 发送
    * @param array $phone
    * @return array
    */
	public static function send ($phone){
		$mail = new \PHPMailer(true); //建立邮件发送类
		$mail->CharSet = "UTF-8";//设置信息的编码类型
		
		$receiving_address = "605403358@qq.com";//收件人地址
		$receiving_name = "wfs";//收件人地址
		
		
		$mail->IsSMTP(); // 使用SMTP方式发送
		$mail->Host = "smtp.qq.com"; //使用qq邮箱服务器
		$mail->SMTPAuth = true; // 启用SMTP验证功能
		$mail->SMTPSecure = "ssl";
		$mail->SMTPKeepAlive = true;   
		$mail->Username = "420656345@qq.com"; //你的qq邮箱账号
		$mail->Password = "fvraiyscnxibcadi"; // qq邮箱密码
		$mail->Port = 465;	//邮箱服务器端口号
		
		$mail->From = "420656345@qq.com"; //邮件发送者email地址
		$mail->FromName = "测试邮件";//发件人名称
		$mail->AddAddress("$address", "张三"); //收件人地址，("收件人email","收件人姓名")
		//$mail->AddAttachment("D:\abc.txt"); // 添加附件(注意：路径不能有中文)
		$mail->IsHTML(true);//是否使用HTML格式
		
		$mail->Subject = "测试测试"; //邮件标题
		$mail->Body = "新年快乐"; //邮件内容，上面设置HTML，则可以是HTML
		
		if (!$mail->Send()) {
			echo "邮件发送失败. <p>";
			echo "错误原因: " . $mail->ErrorInfo;
			exit;
		}
	}
	
}


?>